Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add {{target}} substitution to compiletest #126256

Merged
merged 1 commit into from
Jun 12, 2024

Conversation

Veykril
Copy link
Member

@Veykril Veykril commented Jun 11, 2024

In ferrocene we have ui tests testing the cli interface of the compiler, one of which tests the --target flag. To be able to run this on all targets we require a way to specify a valid target in the compile-flags directive that is target independent, as otherwise we can only run the test against the one target we choose to supply in the flags. See https://github.com/ferrocene/ferrocene/blob/383cbc80f4e85859a4055f121f15dac329908346/tests/ui/ferrocene/compiler-arguments/target/target.rs

We figured the project might be able to make use of this substitution as well in the future.

try-job: dist-x86_64-msvc

@rustbot
Copy link
Collaborator

rustbot commented Jun 11, 2024

r? @albertlarsan68

rustbot has assigned @albertlarsan68.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the A-testsuite Area: The testsuite used to check the correctness of rustc label Jun 11, 2024
@rustbot
Copy link
Collaborator

rustbot commented Jun 11, 2024

Some changes occurred in src/tools/compiletest

cc @jieyouxu

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap) labels Jun 11, 2024
Comment on lines +56 to +58
let v = v.trim_start_matches(|c| c == ' ' || c == '=');
let v = if v == "{{target}}" { Some((v, v)) } else { v.split_once("-") };
if let Some((arch, _)) = v {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This just puts {{target}} into arch, probably not ideal but currently the arch string is not used anyways so it's unclear what would be the best thing to do here for now until things do get validated.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you consider adding a new field to RevisionInfo? Since target_arch is an Option, we can leave it as None for {{target}} values.

Copy link
Member

@jieyouxu jieyouxu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The compiletest changes look reasonable to me. The tidy change I'll leave up to T-bootstrap to decide.

@albertlarsan68
Copy link
Member

@bors r+

@bors
Copy link
Contributor

bors commented Jun 11, 2024

📌 Commit 1462f3d has been approved by albertlarsan68

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jun 11, 2024
@ehuss
Copy link
Contributor

ehuss commented Jun 11, 2024

Can you please update the substitutions documentation at https://rustc-dev-guide.rust-lang.org/tests/headers.html#substitutions?

jieyouxu added a commit to jieyouxu/rust that referenced this pull request Jun 11, 2024
…tlarsan68

Add {{target}} substitution to compiletest

In ferrocene we have ui tests testing the cli interface of the compiler, one of which tests the `--target` flag. To be able to run this on all targets we require a way to specify a valid target in the `compile-flags` directive that is target independent, as otherwise we can only run the test against the one target we choose to supply in the flags. See https://github.com/ferrocene/ferrocene/blob/383cbc80f4e85859a4055f121f15dac329908346/tests/ui/ferrocene/compiler-arguments/target/target.rs

We figured the project might be able to make use of this substitution as well in the future.
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 11, 2024
Rollup of 7 pull requests

Successful merges:

 - rust-lang#115974 (Split core's PanicInfo and std's PanicInfo)
 - rust-lang#125659 (Remove usage of `isize` in example)
 - rust-lang#125669 (CI: Update riscv64gc-linux job to Ubuntu 22.04, rename to riscv64gc-gnu)
 - rust-lang#125684 (Account for existing bindings when suggesting `pin!()`)
 - rust-lang#126055 (Expand list of trait implementers in E0277 when calling rustc with --verbose)
 - rust-lang#126174 (Migrate `tests/run-make/prefer-dylib` to `rmake.rs`)
 - rust-lang#126256 (Add {{target}} substitution to compiletest)

r? `@ghost`
`@rustbot` modify labels: rollup
jieyouxu added a commit to jieyouxu/rust that referenced this pull request Jun 11, 2024
…tlarsan68

Add {{target}} substitution to compiletest

In ferrocene we have ui tests testing the cli interface of the compiler, one of which tests the `--target` flag. To be able to run this on all targets we require a way to specify a valid target in the `compile-flags` directive that is target independent, as otherwise we can only run the test against the one target we choose to supply in the flags. See https://github.com/ferrocene/ferrocene/blob/383cbc80f4e85859a4055f121f15dac329908346/tests/ui/ferrocene/compiler-arguments/target/target.rs

We figured the project might be able to make use of this substitution as well in the future.
@jieyouxu
Copy link
Member

@bors r- (suspected to have caused #126277 (comment))

@bors bors added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. labels Jun 11, 2024
@jieyouxu
Copy link
Member

I am suspecting this might need to update a codegen test (#126277 (comment) failed and I'm trying to find out which PR caused the failure and this one seems most likely), but I cannot say for certain. So, let's

@bors try

@bors
Copy link
Contributor

bors commented Jun 11, 2024

⌛ Trying commit 1462f3d with merge 728727a...

bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 11, 2024
Add {{target}} substitution to compiletest

In ferrocene we have ui tests testing the cli interface of the compiler, one of which tests the `--target` flag. To be able to run this on all targets we require a way to specify a valid target in the `compile-flags` directive that is target independent, as otherwise we can only run the test against the one target we choose to supply in the flags. See https://github.com/ferrocene/ferrocene/blob/383cbc80f4e85859a4055f121f15dac329908346/tests/ui/ferrocene/compiler-arguments/target/target.rs

We figured the project might be able to make use of this substitution as well in the future.

try-job: dist-x86_64-msvc
@bors
Copy link
Contributor

bors commented Jun 11, 2024

☀️ Try build successful - checks-actions
Build commit: 728727a (728727a2886e95be9e97995d2aae959cacd56b89)

@jieyouxu
Copy link
Member

... then it was not this PR.

@bors r=@albertlarsan68 rollup

@bors
Copy link
Contributor

bors commented Jun 11, 2024

📌 Commit 1462f3d has been approved by albertlarsan68

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Jun 11, 2024
jhpratt added a commit to jhpratt/rust that referenced this pull request Jun 12, 2024
…tlarsan68

Add {{target}} substitution to compiletest

In ferrocene we have ui tests testing the cli interface of the compiler, one of which tests the `--target` flag. To be able to run this on all targets we require a way to specify a valid target in the `compile-flags` directive that is target independent, as otherwise we can only run the test against the one target we choose to supply in the flags. See https://github.com/ferrocene/ferrocene/blob/383cbc80f4e85859a4055f121f15dac329908346/tests/ui/ferrocene/compiler-arguments/target/target.rs

We figured the project might be able to make use of this substitution as well in the future.

try-job: dist-x86_64-msvc
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 12, 2024
Rollup of 6 pull requests

Successful merges:

 - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts())
 - rust-lang#126127 (Spell out other trait diagnostic)
 - rust-lang#126228 (Provide correct parent for nested anon const)
 - rust-lang#126249 (Simplify `[T; N]::try_map` signature)
 - rust-lang#126256 (Add {{target}} substitution to compiletest)
 - rust-lang#126263 (Make issue-122805.rs big endian compatible)

r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 12, 2024
…tlarsan68

Add {{target}} substitution to compiletest

In ferrocene we have ui tests testing the cli interface of the compiler, one of which tests the `--target` flag. To be able to run this on all targets we require a way to specify a valid target in the `compile-flags` directive that is target independent, as otherwise we can only run the test against the one target we choose to supply in the flags. See https://github.com/ferrocene/ferrocene/blob/383cbc80f4e85859a4055f121f15dac329908346/tests/ui/ferrocene/compiler-arguments/target/target.rs

We figured the project might be able to make use of this substitution as well in the future.

try-job: dist-x86_64-msvc
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 12, 2024
…kingjubilee

Rollup of 8 pull requests

Successful merges:

 - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts())
 - rust-lang#126210 (docs(core): make more const_ptr doctests assert instead of printing)
 - rust-lang#126228 (Provide correct parent for nested anon const)
 - rust-lang#126242 (Simplify provider api to improve llvm ir)
 - rust-lang#126249 (Simplify `[T; N]::try_map` signature)
 - rust-lang#126256 (Add {{target}} substitution to compiletest)
 - rust-lang#126263 (Make issue-122805.rs big endian compatible)
 - rust-lang#126286 (Make `storage-live.rs` robust against rustc internal changes.)

r? `@ghost`
`@rustbot` modify labels: rollup
workingjubilee added a commit to workingjubilee/rustc that referenced this pull request Jun 12, 2024
…tlarsan68

Add {{target}} substitution to compiletest

In ferrocene we have ui tests testing the cli interface of the compiler, one of which tests the `--target` flag. To be able to run this on all targets we require a way to specify a valid target in the `compile-flags` directive that is target independent, as otherwise we can only run the test against the one target we choose to supply in the flags. See https://github.com/ferrocene/ferrocene/blob/383cbc80f4e85859a4055f121f15dac329908346/tests/ui/ferrocene/compiler-arguments/target/target.rs

We figured the project might be able to make use of this substitution as well in the future.

try-job: dist-x86_64-msvc
bors added a commit to rust-lang-ci/rust that referenced this pull request Jun 12, 2024
…kingjubilee

Rollup of 16 pull requests

Successful merges:

 - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts())
 - rust-lang#124514 (Recommend to never display zero disambiguators when demangling v0 symbols)
 - rust-lang#125978 (Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking)
 - rust-lang#125980 (Nvptx remove direct passmode)
 - rust-lang#126187 (For E0277 suggest adding `Result` return type for function when using QuestionMark `?` in the body.)
 - rust-lang#126210 (docs(core): make more const_ptr doctests assert instead of printing)
 - rust-lang#126249 (Simplify `[T; N]::try_map` signature)
 - rust-lang#126256 (Add {{target}} substitution to compiletest)
 - rust-lang#126263 (Make issue-122805.rs big endian compatible)
 - rust-lang#126281 (set_env: State the conclusion upfront)
 - rust-lang#126286 (Make `storage-live.rs` robust against rustc internal changes.)
 - rust-lang#126287 (Update a cranelift patch file for formatting changes.)
 - rust-lang#126301 (Use `tidy` to sort crate attributes for all compiler crates.)
 - rust-lang#126305 (Make PathBuf less Ok with adding UTF-16 then `into_string`)
 - rust-lang#126310 (Migrate run make prefer rlib)
 - rust-lang#126314 (fix RELEASES: we do not support upcasting to auto traits)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 3997b62 into rust-lang:master Jun 12, 2024
7 checks passed
@rustbot rustbot added this to the 1.81.0 milestone Jun 12, 2024
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jun 12, 2024
Rollup merge of rust-lang#126256 - ferrocene:lw-target-subst, r=albertlarsan68

Add {{target}} substitution to compiletest

In ferrocene we have ui tests testing the cli interface of the compiler, one of which tests the `--target` flag. To be able to run this on all targets we require a way to specify a valid target in the `compile-flags` directive that is target independent, as otherwise we can only run the test against the one target we choose to supply in the flags. See https://github.com/ferrocene/ferrocene/blob/383cbc80f4e85859a4055f121f15dac329908346/tests/ui/ferrocene/compiler-arguments/target/target.rs

We figured the project might be able to make use of this substitution as well in the future.

try-job: dist-x86_64-msvc
@tshepang tshepang deleted the lw-target-subst branch June 12, 2024 13:58
bjorn3 pushed a commit to bjorn3/rust that referenced this pull request Jun 30, 2024
…kingjubilee

Rollup of 16 pull requests

Successful merges:

 - rust-lang#123374 (DOC: Add FFI example for slice::from_raw_parts())
 - rust-lang#124514 (Recommend to never display zero disambiguators when demangling v0 symbols)
 - rust-lang#125978 (Cleanup: HIR ty lowering: Consolidate the places that do assoc item probing & access checking)
 - rust-lang#125980 (Nvptx remove direct passmode)
 - rust-lang#126187 (For E0277 suggest adding `Result` return type for function when using QuestionMark `?` in the body.)
 - rust-lang#126210 (docs(core): make more const_ptr doctests assert instead of printing)
 - rust-lang#126249 (Simplify `[T; N]::try_map` signature)
 - rust-lang#126256 (Add {{target}} substitution to compiletest)
 - rust-lang#126263 (Make issue-122805.rs big endian compatible)
 - rust-lang#126281 (set_env: State the conclusion upfront)
 - rust-lang#126286 (Make `storage-live.rs` robust against rustc internal changes.)
 - rust-lang#126287 (Update a cranelift patch file for formatting changes.)
 - rust-lang#126301 (Use `tidy` to sort crate attributes for all compiler crates.)
 - rust-lang#126305 (Make PathBuf less Ok with adding UTF-16 then `into_string`)
 - rust-lang#126310 (Migrate run make prefer rlib)
 - rust-lang#126314 (fix RELEASES: we do not support upcasting to auto traits)

r? `@ghost`
`@rustbot` modify labels: rollup
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-testsuite Area: The testsuite used to check the correctness of rustc S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-bootstrap Relevant to the bootstrap subteam: Rust's build system (x.py and src/bootstrap)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants